<?php
function logToFile($msg)
{
	$filename = "log.txt";
	// open file
	$fd = fopen($filename, "a");
	// append date/time to message
	$str = "[" . date("Y/m/d h:i:s", mktime()) . "] " . $msg;
	// write string
	fwrite($fd, $str . "\n");
	// close file
	fclose($fd);

	//error_log("You messed up!", 3, "log.txt");
}

function checkIfAdmin(){

	$admins = array("Slater", "Mitch", "AlexTheGreat");

	if(isset($_SESSION['user'])){
		$user = $_SESSION['user'];

		foreach ($admins as $key => $value) {
            if ($value == $user->user_name) {
            	return true;
            }
        }

        return false;
	}else{
		return false;
	}
}
?>
